package com.tanhua.server.task;

import com.tanhua.server.service.VoiceService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 每天凌晨12点开始刷新redis中用户的接收语音次数
 */
@Component
@Slf4j
public class TimeTask {

    @Autowired
    private VoiceService voiceService;

    // 每天凌晨12点开始刷新redis中用户的接收语音次数
    @Scheduled(cron = "0 0 0 * * ?")
    public void analysis(){
        log.info("修改次数任务开始执行.....");
        //调用service的方法完成统计
        voiceService.updTimeSize();
        voiceService.UploadVoice();
        log.info("修改次数任务完成!!!");
    }

}
